﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HelloInstance.Test
{
    public class UnitInstance
    {
        [Fact]
        public void InstanceTest()
        {
            var instance1 = SingletonClassIdler.Instance;
            var instance2 = SingletonClassIdler.Instance;
            Assert.Equal(instance1, instance2);
            var instance3 = SingletonClassHunger.Instance;
            var instance4 = SingletonClassHunger.Instance;
            Assert.Equal(instance3, instance4);
            var instance5 = SingletonClassLazy.Instance;
            var instance6 = SingletonClassLazy.Instance;
            Assert.Equal(instance5, instance6);
            var instance7 = SingletonClassInner.Instance;
            var instance8 = SingletonClassInner.Instance;
            Assert.Equal(instance7, instance8);
            var instance9 = MySingleton.Instance;
            var instance10 = SingletonAbstract<MySingleton>.Instance;
            Assert.Equal(instance9, instance10);
        }
    }
}
